/**
 * Created by PC on 2017/8/30.
 */
$().ready(function () {
// 在键盘按下并释放及提交后验证提交表单
    $("form").validate({
        rules: {
            product_name: { // 产品名
                required: true,
                maxlength: 16
            },
            price: { // 总价格
                number: true,  // 有效数字 整数活 负数 活小数
                maxlength: 7
            },
            user_tel: { // 发货时间
                required: true,
                maxlength: 16,
                minlength: 7
            },
            user_name: { // 收货人姓名
                required: true,
                maxlength: 6,

            },
            charge: { // 运费价格
                // required: true,
                maxlength: 5
            }

        },
        messages: {
            product_name: {
                required: "请输入产品名",
                maxlength: "用户名最长不超过16个字符"
            },
            price: {
                maxlength: "请输入6位数以内的整数或小数",
                number:"只能输入有效数字"
            },
            user_tel: {
                required: "请输入有电话",
                maxlength: "请正确输入电话号",
                minlength: "请正确输入电话号"
            },
            user_name: {
                required: "请输入有效姓名",
                maxlength: "请输入6个字符以内的姓名"
            },
            charge: {
                // required: "请输入运费",
                maxlength: "请输入5个字符以内的数值"
            },
        }
    })
});